package com.yitianyigexiangfa.dubbo;

import com.alibaba.dubbo.rpc.protocol.rest.support.ContentType;
import com.yitianyigexiangfa.dubbo.entity.Book;
import com.yitianyigexiangfa.dubbo.entity.Person;

import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;

/**
 * @author Bill Lau
 */
@Path("book")
public interface IBookService {

    @Path("getBooks")
    @GET
    @Produces({ContentType.TEXT_PLAIN_UTF_8})
    public String getBooks();

    @Path("getBookById/{id}")
    @POST
    @Consumes({ ContentType.APPLICATION_JSON_UTF_8})
    @Produces({ContentType.APPLICATION_JSON_UTF_8})
    public Book getBookById(@PathParam("id") int id);

    @POST
    @Path("getBookByPerson")
    @Consumes({ContentType.APPLICATION_JSON_UTF_8})
    @Produces({ContentType.APPLICATION_JSON_UTF_8})
    public Book getBookByPerson(Person person);

}
